package com.javacore;

import javax.swing.*;

public class MyArray {

	int n = 5;
	int[] a;

	void input() {
		a = new int[n];
		for (int i = 0; i < n; i++) {
			String S = JOptionPane.showInputDialog(null, "Input element: " + i,
					"0");
			a[i] = Integer.parseInt(S);
		}
	}

	void Output() {
		String S = "";
		for (int i = 0; i < n; i++) {
			S += i < n - 1 ? a[i] + ", " : a[i];
		}
		JOptionPane.showMessageDialog(null, "Output array: " + S);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyArray myArray = new MyArray();
		myArray.input();
		myArray.Output();
	}

}
